Skip to content

Conversation

@WangxuP
Copy link

@WangxuP WangxuP commented Feb 8, 2025

In streaming output mode, the content in delta is missing from the second to last data #11746

My solution is to add a default value to the output content

Make sure to read the contributing guidelines before submitting a PR

…cond to last data ggml-org#11746

My solution is to add a default value to the output content
@WangxuP WangxuP requested a review from ngxson as a code owner February 8, 2025 03:29
@WangxuP WangxuP changed the title In streaming output mode, the content in delta is missing from the se… In streaming output mode, the content in delta is missing from the second to last data #11746 Feb 8, 2025
@ngxson
Copy link
Collaborator

ngxson commented Feb 8, 2025

I'm not the one who wrote this code in the first place, but IIRC there was a comment about us doing this to match the behaviour of openai API.

I can consider merging this if you can verify that. Otherwise, I will close this PR as it may not be a bug.

@ngxson
Copy link
Collaborator

ngxson commented Feb 9, 2025

I'm closing this because this is not a valid bug. OAI API having the same "delta":{} on the last message:

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":{"content":[],"refusal":null},"finish_reason":null}]}

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{"content":"Sol"},"logprobs":{"content":[{"token":"Sol","logprob":-4.2846212,"bytes":[83,111,108],"top_logprobs":[{"token":"Ser","logprob":-0.53462136,"bytes":[83,101,114]},{"token":"Qu","logprob":-2.7846212,"bytes":[81,117]},{"token":"Ze","logprob":-2.7846212,"bytes":[90,101]},{"token":"Ep","logprob":-3.0346212,"bytes":[69,112]},{"token":"E","logprob":-3.5346212,"bytes":[69]}]}],"refusal":null},"finish_reason":null}]}

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"length"}]}

@WangxuP
Copy link
Author

WangxuP commented Feb 10, 2025

I'm closing this because this is not a valid bug. OAI API having the same "delta":{} on the last message:

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":{"content":[],"refusal":null},"finish_reason":null}]}

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{"content":"Sol"},"logprobs":{"content":[{"token":"Sol","logprob":-4.2846212,"bytes":[83,111,108],"top_logprobs":[{"token":"Ser","logprob":-0.53462136,"bytes":[83,101,114]},{"token":"Qu","logprob":-2.7846212,"bytes":[81,117]},{"token":"Ze","logprob":-2.7846212,"bytes":[90,101]},{"token":"Ep","logprob":-3.0346212,"bytes":[69,112]},{"token":"E","logprob":-3.5346212,"bytes":[69]}]}],"refusal":null},"finish_reason":null}]}

data: {"id":"chatcmpl-Ayz7toKtZV6ZO6LnxkfNTvNp6lE8v","object":"chat.completion.chunk","created":1739098013,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_50cad350e4","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"length"}]}

ok, Thanks for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants